var path = require('path'),
    ueditorController = require("ueditor"),
    site = require('./admin/site/main'),
    menu = require('./admin/menus/main'),
    news = require('./admin/news/main');

module.exports = function(app) {

    //站点
    app.get("/admin/site", site.render);
    app.post("/admin/site/add", site.add);
    app.post("/admin/site/del", site.del);
    app.post("/admin/site/edit", site.edit);

    //菜单
    app.get("/admin/menus", menu.render);
    app.post("/admin/menus/add", menu.add);
    app.post("/admin/menus/del", menu.del);
    app.post("/admin/menus/edit", menu.edit);

    //新闻
    app.get("/admin", news.render);
    app.post("/admin/news/add", news.add);
    app.post("/admin/news/dels", news.dels);
    app.post("/admin/news/edit", news.edit);
    app.get("/admin/news/select", news.select);
    app.get("/admin/news/:page", news.render);
    app.get("/admin/newsDetail", news.renderDetail);
    app.get("/admin/newsDetail/:page/:id", news.renderDetail);
    app.all("/lib/ueditor/ueditor/ue", ueditorController(path.join(global.rootPath, 'assets'), news.uploadimage));

};